Conversation
There was a problem hiding this comment.
Pull request overview
Introduces a new Event Catalog feature that lets consumers query registered events per entity type (including metadata and compile-time generated JSON Schemas), adds source-generator support to emit DI registration for the catalog, and provides a runnable sample + documentation.
Changes:
- Added
IEventCatalogAPI + default provider/registration types for event catalog listing and schema-backed event detail lookup. - Extended source generator to emit
AddCodeGeneratedEventCatalog()and generate JSON Schemas for catalog entries. - Added tests, documentation, and a new
SampleEventCatalogsample project demonstrating querying + schema validation.
Reviewed changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/Papst.EventStore.Tests/EventCatalog/EventCatalogProviderTests.cs | Adds unit tests covering registration, filtering, lazy schema evaluation, and entity-scoped/global lookups. |
| tests/Papst.EventStore.CodeGeneration.Tests/CodeGeneratorTests.cs | Refactors tests to share compilation creation via a base class. |
| tests/Papst.EventStore.CodeGeneration.Tests/CodeGeneratorTestBase.cs | Introduces shared CreateCompilation helper for codegen tests. |
| tests/Papst.EventStore.CodeGeneration.Tests/CodeGeneratorCatalogTests.cs | Adds generator tests validating catalog method emission + embedded schema output. |
| src/Papst.EventStore/EventCatalog/IEventCatalogRegistration.cs | Adds registration contract used for catalog population and lookup. |
| src/Papst.EventStore/EventCatalog/IEventCatalog.cs | Adds public read API for listing events and retrieving schema-backed details. |
| src/Papst.EventStore/EventCatalog/EventCatalogRegistration.cs | Implements in-memory catalog storage, filtering, and detail lookup with lazy schema evaluation. |
| src/Papst.EventStore/EventCatalog/EventCatalogProvider.cs | Adds default IEventCatalog implementation that aggregates multiple registrations. |
| src/Papst.EventStore/EventCatalog/EventCatalogEventDetails.cs | Adds record type for detailed event info including JSON schema. |
| src/Papst.EventStore/EventCatalog/EventCatalogEntry.cs | Adds record type for lightweight catalog entries. |
| src/Papst.EventStore.CodeGeneration/EventRegistrationIncrementalCodeGenerator.cs | Extends generator to build catalog entries, generate schema fields, and emit AddCodeGeneratedEventCatalog(). |
| src/Papst.EventStore.Aggregation.EventRegistration/EventNameAttribute.cs | Extends event naming attributes with Description/Constraints and adds generic EventNameAttribute<TEntity>. |
| samples/SampleEventCatalog/SampleEventCatalog.csproj | Adds a new sample project referencing codegen + JsonSchema.Net. |
| samples/SampleEventCatalog/Program.cs | Demonstrates catalog queries and JSON Schema validation. |
| samples/SampleEventCatalog/Events.cs | Defines sample entities/events annotated for catalog generation. |
| README.md | Documents Event Catalog usage and generated registration method. |
| Papst.EventStore.slnx | Adds the new sample project to the solution. |
| Directory.Packages.props | Adds centralized version for JsonSchema.Net. |
- Introduced Event Catalog for managing events associated with entity types, including metadata and JSON Schema generation. - Updated `ListEvents` and `GetEventDetails` methods in `EventCatalogProvider` to return `ValueTask` for better async performance. - Enhanced `EventCatalogRegistration` to support entity-scoped event details retrieval. - Added tests for event catalog generation, JSON Schema validation, and entity-scoped event details. - Updated sample application to demonstrate new Event Catalog features and JSON Schema validation. - Replaced `FluentAssertions` with `JsonSchema.Net` for JSON Schema handling.
…g methods to handle ambiguous event names
383e786 to
5f4f262
Compare
5f4f262 to
ae1f13c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces a new Event Catalog feature, providing a queryable registry of all events associated with entity types, complete with metadata and compile-time generated JSON Schemas. It includes a working sample (
SampleEventCatalog), new APIs, and documentation updates. The Event Catalog enables runtime introspection, documentation, and validation of events, and supports filtering and detailed schema-based inspection.Event Catalog Feature Implementation:
IEventCatalogAPI and default implementation (EventCatalogProvider) for querying events and their metadata, including JSON Schema, by entity type and event name.EventCatalogEntryandEventCatalogEventDetailsrecords to represent lightweight and detailed event metadata, respectively. [1] [2]EventCatalogRegistrationfor in-memory registration and lookup of events, supporting filtering by name and constraints.Attribute and Metadata Enhancements:
EventNameAttributeand introduced genericEventNameAttribute<TEntity>to allow associating events with entities, including optional description and constraints metadata.Documentation and Sample:
README.md.SampleEventCatalog, demonstrating registration, querying, and JSON Schema validation of events. [1] [2] [3] [4]Dependency Updates:
JsonSchema.Netpackage to support JSON Schema generation and validation.